﻿using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Tree;
using AntlrTS.LangFundmental;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AntlrTS.LanguagePatterns
{
    public class GetDotVariables:TSBaseListener
    {
        List<Variable> variables=new List<Variable>();
        public override void EnterVariable(TSParser.VariableContext context)
        {
            var variable=new Variable();
            variable.rawStringName=context.GetText();
            variables.Add(variable);
        }


        public static List<Variable> getVariables(IParseTree x)
        {
            GetDotVariables lis = new GetDotVariables();
            ParseTreeWalker walker = new ParseTreeWalker();
            walker.Walk(lis, x);
            return lis.variables;
        }
    }
}
